{%- set fruit_model = salt['pillar.get']('default:OMV_SAMBA_FRUIT_MODEL', 'TimeCapsule') -%}
<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
    <name replace-wildcards="yes">{{ name }}</name>
    <service>
        <type>{{ type }}</type>
        <port>{{ port }}</port>
    </service>
{%- if shares | selectattr('timemachine') | list | length > 0 %}
    <service>
        <type>_adisk._tcp</type>
        <txt-record>sys=adVF=0x100</txt-record>
{%- for share in shares | selectattr('timemachine') %}
        <txt-record>dk{{ loop.index0 }}=adVN={{ salt['omv_conf.get_sharedfolder_name'](share.sharedfolderref) }},adVF=0x82</txt-record>
{%- endfor %}
    </service>
    <service>
        <type>_device-info._tcp</type>
        <port>0</port>
        <txt-record>model={{ fruit_model }}</txt-record>
    </service>
{%- endif %}
</service-group>
